package com.ar4j.bench.common.service;

import java.util.List;

import com.ar4j.bench.common.domain.IProduct;
import com.ar4j.bench.common.domain.ProductWithItems;

/**
 * The API for all product service implementations, defines the minimum set of operations required to run the benchmark tests.
 */
public interface IProductService {

  /**
   * Add the given product to the backing store
   */
  Long addProduct(IProduct product);
  
  /**
   * Retrieve a product from the backing store by its ID
   */
  IProduct findById(Long id);
  
  /**
   * Retrieve a list of products by their category ID
   */
  List<IProduct> findByCategoryId(Long categoryId);
  
  /**
   * Update a product in the backing store
   */
  void updateProduct(IProduct product);
  
  /**
   * Remove a product with the given ID from the backing store
   */
  void removeById(Long id);
  
  /**
   * Add a product composite (w/ items) to the backing store
   */
  Long addProductWithItems(ProductWithItems product);
  
  /**
   * Retrieve a product composite (w/ items) to the backing store
   */
  ProductWithItems findProductWithItemsById(Long id);
  
  /**
   * Retrieve a list product composites (w/ items) to the backing store by searching for their category ID
   */
  List<ProductWithItems> findProductWithItemsByCategoryId(Long categoryId);
  
  /**
   * Update a product composite (w/ items) to the backing store
   */
  void updateProductWithItems(ProductWithItems product);
  
  /**
   * Remove a product composite (w/ items) to the backing store by its product ID
   */
  void removeProductWithItemsById(Long id);
  
}
